define(function(require, exports, module) {
	"use strict";

	var baseService = require('Base_Service');
	// 控制器名
	exports.controller = "Register";
	
	/* 自主报名商品列表 */
	exports.getSelfs = function(currpage, pageSize, drivingTitle, areaId, lowerPrice, upperPrice, drivingLicenseType, orderBy, success) {
		var data = {
			pageIndex: currpage,
			pageSize: pageSize,
			DrivingTitle:drivingTitle,
			AreaId:areaId,
			LowerPrice:lowerPrice,
			UpperPrice:upperPrice,
			DrivingType:drivingLicenseType,
			OrderBy:orderBy
		};
		return baseService.get(
			baseService.getApiUrl(exports.controller, "Self", data),
			{},
			function(retval) {
				success && success(retval);
			}
		);
	};
	
	/* 团购报名商品列表 */
	exports.getGroups = function(currpage, pageSize, drivingTitle, areaId, lowerPrice, upperPrice, drivingLicenseType, orderBy, success) {
		var data = {
			pageIndex: currpage,
			pageSize: pageSize,
			DrivingTitle:drivingTitle,
			AreaId:areaId,
			LowerPrice:lowerPrice,
			UpperPrice:upperPrice,
			DrivingType:drivingLicenseType,
			OrderBy:orderBy
		};
		return baseService.get(
			baseService.getApiUrl(exports.controller, "Group", data),
			{},
			function(retval) {
				success && success(retval);
			}
		);
	};
	
	/* 传统报名商品列表 */
	exports.getDefaults = function(currpage, pageSize, drivingTitle, areaId, lowerPrice, upperPrice, drivingLicenseType, orderBy, success) {
		var data = {
			pageIndex: currpage,
			pageSize: pageSize,
			DrivingTitle:drivingTitle,
			AreaId:areaId,
			LowerPrice:lowerPrice,
			UpperPrice:upperPrice,
			DrivingType:drivingLicenseType,
			OrderBy:orderBy
		};
		return baseService.get(
			baseService.getApiUrl(exports.controller, "Default", data),
			{},
			function(retval) {
				success && success(retval);
			}
		);
	};
	
	
	/* 报名 */
	exports.apply = function(data ,success) {
		return baseService.post(
			baseService.getApiUrl(exports.controller, "apply"),
			data,
			function(retval) {
				success && success(retval);
			}
		);
	};
	
	/* 报名记录 */
	exports.getApplys = function(currpage, pageSize, success) {
		var data = {
			pageIndex: currpage,
			pageSize: pageSize
		};
		return baseService.post(
			baseService.getApiUrl(exports.controller, "List"),
			data,
			function(retval) {
				success && success(retval);
			}
		);
	};
	
	/* 报名详情 */
	exports.getApply = function(id, success) {
		var data = "id="+id;
		return baseService.get(
			baseService.getApiUrl(exports.controller, "Detail"),
			data,
			function(retval) {
				success && success(retval);
			}
		);
	};
	
});